# -*- coding: utf-8 -*-
"""
Author: chen xi
Date: 2025/7/9 下午2:42
File: handle_exceptions.py
"""


def catch_exception(expected_exception=Exception, default_value=None):
	def decorator(func):
		def wrapper(*args, **kwargs):
			try:
				return func(*args, **kwargs)
			except expected_exception as e:
				print(f"捕获到指定异常：{e}")
				return default_value
		
		return wrapper
	
	return decorator

